define(function(require){
	var main = require('/static/main.js');
	require('/static/jquery.z-pager.js');
	var m = new main();
	function Cont(){
		this.Fun._init();
	}
	Cont.prototype.Fun = {
		_init:function(){
			// 初始化左边菜单
		    this.getlist();
			this.bindEvent();
		},
		getlist:function(getdata){
			if(!getdata){
				var getdata = '';
			}
        	$("#pager").zPager({
		        url:'/news/newslist'+getdata,
		        pageData:4,
		        btnShow: false,
		        pageStep:8,
		        dataRender: function(data){
		        		var str = '';
		        		if(data[0] == "暂无数据"){
		        			str += '暂无发送记录'
		        			$('.list').css({'text-align':'center'});
		        			$('#pager').hide();
		        		}else{
			        		$.each(data,function(k,v){
			        			var bgc = '',btn = '';
			        			switch(v.SendType){
			        				case 100:
			        					btn = '全体'
			        					bgc = "class='bg00aeae'"
			        					break;
			        				case 200:
			        					btn = v.Phones
			        					bgc = "class='bg338ee3'"
			        					break;
			        				case 300:
			        					btn = '标签'
			        					bgc = "class='bg717cb6'"
			        					break;
			        				case 400:
			        					btn = '分组'
			        					bgc = "class='bgff5f63'"
			        					break;	
			        			}
			               		str+='<div class="m-b-20 ">\
					                    <div class="newsmodel_choseall">\
					                        <div class="row" style="margin:0px;">\
					                            <div class="col-md-12" style="padding-left: 0px;">\
					                                <div class="tit">'+m.formatTimeAll2(v.CreateTime)+'</div>\
					                                <div><span class="status">【'+v.StateName+'】</span>短信内容 ：'+v.Content+'</div>\
					                            </div>\
					                        </div>\
					                        <div class="row" style="margin:0px;margin-top: 20px;">\
					                            <div class="newsmodel_choseallsign">\
					                                <div class="newsmodel_signeach">\
					                                    <ul>\
					                                        <li '+bgc+'>'+btn+'</li>\
					                                    </ul>\
					                                </div>\
					                            </div>\
					                        </div>\
					                    </div>\
					                </div>'
			               	})
		        		}
		               	$('.list').html(str);
		        },
		    });
		},
		bindEvent:function(){
			var _this = this;
	        // 点击搜索
	        $('#btnSearch').click(function(){
	        	var StartTime = $('.StartTime').val();
	        	var EndTime = $('.EndTime').val();
	        	var href = '?StartTime='+StartTime+'&EndTime='+EndTime;
	        	_this.getlist(href);
	        })
	        // 点击重置按钮
	        $('#btnRefresh').click(function(){
	        	$('.StartTime').val('');
	        	$('.EndTime').val('');
	        })
		}


	}
	var a = new Cont();

})